package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
	"shopping_gc/setting"
)

func main() {
	router := gin.Default()
	router.LoadHTMLGlob("html/*")
	router.GET("/testgc", func(context *gin.Context) {
		context.JSON(200, gin.H{"message": "gc"})
	})
	router.GET("/testgchtml", func(context *gin.Context) {
		context.HTML(http.StatusOK,"gc.html",gin.H{"name": "gc","age":26})
	})
	ser := &http.Server{
		Addr:           fmt.Sprintf(":%d", setting.HTTPPort),
		Handler:        router,
		ReadTimeout:    setting.ReadTimeOut,
		WriteTimeout:   setting.WriteTimeOut,
		MaxHeaderBytes: 1 << 20,
	}
	ser.ListenAndServe()
}
